unit uPlayer;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes,
  System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
  AVPlayer, FMX.ListBox, FMX.StdCtrls, FMX.Layouts;

type
  TfmPlayer = class(TForm)
    Player: TAVPlayer;
    Viewer: TAVView;
    Estilo: TStyleBook;
    LayTop: TLayout;
    cmbCamaras: TComboBox;
    ListBoxItem9: TListBoxItem;
    ListBoxItem1: TListBoxItem;
    ListBoxItem2: TListBoxItem;
    ListBoxItem3: TListBoxItem;
    ListBoxItem4: TListBoxItem;
    ListBoxItem5: TListBoxItem;
    ListBoxItem6: TListBoxItem;
    ListBoxItem7: TListBoxItem;
    ListBoxItem8: TListBoxItem;
    ListBoxItem10: TListBoxItem;
    pnlAviso: TPanel;
    lblAviso: TLabel;
    LayCli: TLayout;
    btnIconoRecargar: TButton;
    LayBot: TLayout;
    btnSalir: TButton;
    btnIconoSalir: TButton;
    btnRecargar: TButton;
    procedure cmbCamarasChange(Sender: TObject);
    procedure ViewerClick(Sender: TObject);
    procedure btnIconoSalirClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmPlayer: TfmPlayer;

implementation

Uses uGlobal;

{$R *.fmx}

procedure TfmPlayer.ViewerClick(Sender: TObject);
begin
  if (LayTop.Visible = True) and (LayBot.Visible = True) Then
  Begin
    LayTop.Visible := False;
    LayBot.Visible := False;
  End
  Else
  Begin
    LayTop.Visible := True;
    LayBot.Visible := True;
  End;
end;

procedure TfmPlayer.btnIconoSalirClick(Sender: TObject);
begin
  Player.CloseMovie;
  Close;
end;

procedure TfmPlayer.cmbCamarasChange(Sender: TObject);
begin
  if cmbCamaras.Selected.Index <> 9 then
  Begin
    Viewer.Player.CloseMovie;
    try
      Viewer.Player.OpenMovie(Camaras[cmbCamaras.Selected.Index]);
    except
      ShowMessage('Camara no disponible');
    end;
  End;
end;

end.
